<script type="text/javascript">
$( loadPlayer );

function loadPlayer() {
	$.ajax({
		type: "GET", 
	    url: "/rest/players/<%= request.getParameter("playerId") %>",
	    dataType: "json",
	    beforeSend: function(){
			showLoading(true);
	    },
	    success: function(data){
	    	showLoading(false);
	      	$("#playername").html(data.playername);
	      	$("#player_details").append("id = " + data.id);
	      	$("#player_details").append("email = " + data.email);
	      	$("#player_details").append("name = " + data.name);
	      	$("#player_details").append("prename = " + data.prename);
	  	}
	});	
}

function showLoading(show) {
	if (show) {
		$("#content_player_body_loading").show();
		$("#content_player_body").hide();
	} else {
		$("#content_player_body_loading").hide();
		$("#content_player_body").show();
	}
}
</script>

<h2>PLAYER</h2>
<br/>
<div id="content_player" align="center">
	<div id="content_player_body_loading" align="center">
		<img src='loading.gif' alt='loading...' />
	</div>
	<div id="content_player_body" align="center">
		<br/>
		<h3 id="playername"></h3>
		<br/>
		<div id="player_details">
		</div>
	</div>
</div>